package cn.elwy.rcp.ui.listener;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;

/**
 * 释放图像资源监听
 * 
 * @author huangsq
 * @version 1.0, 2013-11-20
 * @since 1.0, 2013-11-20
 */
public class ImageDispose implements DisposeListener {

  private Image image;

  public ImageDispose(Image image) {
    this.image = image;
  }

  public void widgetDisposed(DisposeEvent event) {
    if (image != null && !image.isDisposed()) {
      image.dispose();
    }
  }

}